home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!marnold
- From: marnold@netcom.com (Matt Arnold)
- Subject: Re: forward referencing in Borland 4.52
- Message-ID: <marnoldDLD928.70@netcom.com>
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- References: <4dkfk2$e4v@cloner3.netcom.com>
- Date: Thu, 18 Jan 1996 07:34:56 GMT
- Sender: marnold@netcom9.netcom.com
-
- regmia@ix.netcom.com writes:
-
-
-
- >Does anyone know how to CORRECTLY create a forward reference to
- >class.
-
- >For those of you who may not understand what I am referring to:
-
- >Forward referencing of a class means to declare a variable of a class
- >type and be able to use that variable BEFORE the class is actually
- >defined.
-
-
- >Please some one help me!!
- >E-Mail me at regmia@ix.netcom.com because I don't come here but once a
- >week.
-
- class Bar; // this is forward reference
-
- class Foo
- {
- Bar* pBar; // here, this is legal because of the forward reference
- Bar& rBar; // again, this is legal
-
- // if there were no "class Bar;" above, both Bar variable
- // declarations above would be illegal
-
- Bar bar; // ILLEGAL! you can only use forward references for
- // pointer or reference member variables, not embedded
- // class members
- };
-
- class Bar // here, I finally delcare/define Bar AFTER having referred
- { // to it in Foo
- };
-
-
- Regards,
- -------------------------------------------------------------------------
- Matt Arnold | | ||| | |||| | | | || ||
- marnold@netcom.com | | ||| | |||| | | | || ||
- Boston, MA | 0 | ||| | |||| | | | || ||
- 617.389.7384 (h) 617.576.2760 (w) | | ||| | |||| | | | || ||
- C++, MIDI, Win32/95 developer | | ||| 4 3 1 0 8 3 || ||
- -------------------------------------------------------------------------
-